import { ElMessage } from "element-plus";


const showMessage = (message,callback,type) => {
    ElMessage({
        message,
        type,
        duration: 2000,
        onClose: () => {
            if (callback) {
                callback()
            }
        }
    })
}

const Mymessage = {
    success: (message,callback) => {
        showMessage(message,callback,'success')
    },
    error: (message,callback) => {
        showMessage(message,callback,'error')
    },
    warning: (message,callback) => {
        showMessage(message,callback,'warning')
    },
    info: (message,callback) => {
        showMessage(message,callback,'info')
    }
}

export default Mymessage